export function findNearestVerticalScrollParent(node) {
  if (node === document.body) {
    return null
  }

  const parent = node.parentNode

  const overflowStyle = getComputedStyle(parent).getPropertyValue('overflow')
  const overflowYStyle = getComputedStyle(parent).getPropertyValue('overflow-y')
  // console.log('overflow:', overflowStyle, 'overflow-y:', overflowYStyle, node)

  if (
    overflowStyle === 'auto' ||
    overflowYStyle === 'auto' ||
    overflowStyle === 'scroll' ||
    overflowYStyle === 'scroll'
  ) {
    return parent
  } else {
    return findNearestVerticalScrollParent(parent)
  }
}
